//
//  ViewController.m
//  数据访问对象模式
//
//  Created by flannery on 2018/12/18.
//  Copyright © 2018年 flannery. All rights reserved.
//

#import "ViewController.h"
#import "StudentDaoImpl.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    id<StudentDao> studentDao = StudentDaoImpl.new;
    
    //输出所有的学生
    for (Student *student in [studentDao getAllStudents]) {
        NSLog(@"%@", [student description]);
    }

    //更新学生
    Student *student = [[studentDao getAllStudents] objectAtIndex:0];
    [student setName:@"Michael"];
    [studentDao updateStudent:student];
    
    //获取学生
    NSLog(@"%@", [[studentDao getStudent:0] description]);
}


@end
